﻿using BDShop.DAL;
using BDShop.Entities;
using System;
using System.Collections.Generic;
using IsolationLevel = System.Transactions.IsolationLevel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BDShop.Business
{
    public class CityService
    {
        public static List<City> GetAll()
        {
            List<City> city;
            using (var context = new BDShopEntities(IsolationLevel.ReadUncommitted))
            {
                city = context.Cities.OrderBy(c => c.Order).ToList();
            }

            return city;
        }

        public static City GetByID(int id)
        {
            using (var context = new BDShopEntities(IsolationLevel.ReadUncommitted))
            {
                return context.Cities.FirstOrDefault(c => c.ID==id);
            }

        }
    }
}
